package com.stillalive.springioc.component;

import com.stillalive.springioc.model.Student;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

@Component
public class StudentComponent {
    // 无参默认为s1
    // bean名也可以指定多个
    @Bean
    // s1就是一个Bean
    public Student s1(){
        return new Student("zhangsan", 11);
    }

    @Bean
    public Student s2(){
        return new Student("lisi", 12);
    }

//    @Bean
//    public String name(){
//        return "zhangsan";
//    }
//    @Bean
//    // 这里String类型的参数在容器中找不到，需要再指定一个放在容器中
//    public Student s3(String name){
//        return new Student(name, 14);
//    }
}
